// Waiting for player-input 

	window.addEventListener('keyup', function (event) {
		Key.onKeyup(event);
	}, false);

	window.addEventListener('keydown', function (event) {
		Key.onKeydown(event);
	}, false);

	// Assigns a "code" to a pressed button for better clearness
	var Key = {
		_pressed : {},

		A : 65,
		W : 87,
		D : 68,
		S : 83,
		P : 80,
		SPACE : 32,
		UP : 38,
		DOWN : 40,
		LEFT : 37,
		RIGHT : 39,
		ENTER : 13,
		ESC: 27,

		// These functions return the assigned code, when key isDown/onKeyDown/onKeyup
		isDown : function (keyCode) {
			return this._pressed[keyCode];
		},

		onKeydown : function (event) {
			this._pressed[event.keyCode] = true;
		},

		onKeyup : function (event) {
			delete this._pressed[event.keyCode];
		}
	};
